<template>
	<div :class="curClassName" :style="curStyle">
		<slot></slot>
	</div>
</template>
<script setup lang="ts">
import { CtrlPosProps } from './ctrl-pos';
const props = defineProps(CtrlPosProps);

/**
 * 项名称
 *
 * @memberof AppCtrlPos
 */
const itemName = computed(() => {
	return props.index || props.index === 0
		? `${props.name}_${props.index}`
		: props.name;
});

/**
 * 当前容器样式
 *
 * @memberof AppCtrlPos
 */
const curStyle = computed(() => {
	const layoutModel = props.layoutModelDetails[itemName.value];
	if (layoutModel) {
		return layoutModel.getElementStyle();
	}
});

/**
 * 类名
 *
 * @memberof AppCtrlPos
 */
const curClassName = computed(() => {
	const layoutModel = props.layoutModelDetails[itemName.value];
	if (layoutModel) {
		return `app-ctrl-pos ${itemName.value} ${layoutModel.sysCss || ''}`;
	}
});
</script>
